package com.woniuxy.cloud.carl.user.client;


import com.woniuxy.cloud.carl.user.client.param.LoginByEmailParam;
import com.woniuxy.cloud.carl.user.client.param.LoginByPhoneParam;
import com.woniuxy.cloud.carl.user.client.param.RegisterParam;
import com.woniuxy.cloud.carl.user.client.param.SetUserInfoParam;
import com.woniuxy.result.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;

/**
* name是项目名，contextId是client的名字
*/
@FeignClient(contextId = "userManageClient",name="user",path="user")
public interface UserManageClient {

    @PostMapping("loginByPhone")
    public Result<String> loginByPhone(@RequestBody LoginByPhoneParam param);

    @PostMapping("loginByEmail")
    public Result<String> loginByEmail(@RequestBody LoginByEmailParam param);


    @PostMapping("register")
    public Result register(@RequestBody RegisterParam registerParam);

    @PutMapping("avatar")
    public Result setAvatar(@RequestParam("avatarUrl") String avatarUrl, @RequestParam("userId") Long userId);

    @PutMapping("userInfo")
    public Result setUserInfo(@RequestBody SetUserInfoParam setUserInfoParam);

    @GetMapping("beVip")
    public Result beVip(@RequestParam("userId") Long userId);
    @PutMapping("setScore")
    public Result setScore(@RequestParam("userId") Long userId, @RequestParam("amount")BigDecimal amount);

    @PutMapping("setPwd")
    public Result setPwd(@RequestParam("userId") Long userId,@RequestParam("userPassword") String userPassword);

    @GetMapping("sendRegCode")
    public Result sendRegCode(@RequestParam("userPhone") String userPhone);

    @GetMapping("sendLogCode")
    public Result sendLoginCode(@RequestParam("userPhone") String userPhone);

    @GetMapping("setCode")
    public Result useCode(@RequestParam("userId") Long userId, @RequestParam("score")Integer score);


}
